import time #引入时间
def metric(fn):
    start_time = time.time() # 记录开始时间
    fn()                     # 运行函数
    end_time = time.time()   # 记录结束时间
    print('耗时：{:.4f}s'.format(end_time - start_time)) # 计算运行时间=end_time-star_time
    return fn #输出函数值

@metric   # 呼出装饰器
def run():
    time.sleep(1) # 启动时停留一秒，便于观测时间
    l = [x*x for x in range(1,20000)]
    print(type(l))

run()